Name:		zstd
Version:	1.5.2
Release:	1%{?dist}
Summary:	Zstandard lossless data compressor

License:	BSD GPLv2
URL:		https://www.zstd.net
Source0:	https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz

BuildRequires:	gcc-c++

%description
Zstandard, or zstd as short version, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios. It's backed by a very fast entropy stage, provided by Huff0 and FSE library.

# do not install shared libraries by default
%bcond_with shared

%prep
%setup -q


%build
make PREFIX=%{_prefix} LIBDIR=%{_libdir} %{?_smp_mflags}
make -C contrib/pzstd PREFIX=%{_prefix} LIBDIR=%{_libdir} %{?_smp_mflags}

%install
make PREFIX=%{_prefix} LIBDIR=%{_libdir} DESTDIR=%{buildroot} install
ln -sf zstd %{buildroot}/usr/bin/zstdmt
install -Dm 755 contrib/pzstd/pzstd -t %{buildroot}/usr/bin
rm -f "%{buildroot}/usr/share/info/dir"

%if %{without shared}
rm %{buildroot}/%{_libdir}/libzstd.so*
%endif

%if %{with shared}
%post
/sbin/ldconfig

%postun
/sbin/ldconfig
%endif

%files
%license LICENSE
%{_bindir}/*zstd*
%{_libdir}/libzstd.*
%{_libdir}/pkgconfig/libzstd.pc
%{_mandir}/man1/*zstd*
%{_includedir}/zdict.h
%{_includedir}/zstd.h
%{_includedir}/zstd_errors.h

%changelog

